package NGUYENVANDOAN.OOP.EXCERCISES.LEVEL02.EX05;

public class Stock {
	private String symbol, name;
	private double previousClosingPrice, currentPrice ;
    
    public Stock(String symbol, String name){
         this.symbol = symbol;
         this.name = name;
    }

    public String getSymbol() {
        return symbol;
    }

    public void setSymbol(String symbol) {
        this.symbol = symbol;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getPreviousClosingPrice() {
        return previousClosingPrice;
    }

    public void setPreviousClosingPrice(double previousClosingPrice) {
        this.previousClosingPrice = previousClosingPrice;
    }

    public double getCurrentPrice() {
        return currentPrice;
    }

    public void setCurrentPrice(double currentPrice) {
        this.currentPrice = currentPrice;
    }
    
    public String changePercent(){
    	return (currentPrice<previousClosingPrice) ? 
    					"-"+((previousClosingPrice-currentPrice)/previousClosingPrice)*100 :
    						"+"+((currentPrice-previousClosingPrice)/previousClosingPrice)*100;       
    }
}
